import type { RouteLocationNormalized, RouteRecordRaw } from "vue-router";

export const routes: RouteRecordRaw[] = [
    {
        path: "/",
        component: () => import("@/layout/layout.vue"),
        meta: {
            title: "布局容器",
        },
        children: [
            {
                path: "",
                name: "home",
                component: () => import("@/views/home/home.vue"),
                meta: {
                    title: "首页",

                },
            },
            {
                path: "/article",
                name: "article",
                component: () => import("@/views/article/article.vue"),
                meta: {
                    title: "健康百科",
                },
            },
            {
                path: "/notify",
                name: "notify",
                component: () => import("@/views/notify/notify.vue"),
                meta: {
                    title: "消息通知",
                },
            },
            {
                path: "/user",
                name: "user",
                component: () => import("@/views/user/user.vue"),
                meta: {
                    title: "我的",
                },
            },
        ],
    },
    {
        path: "/login",
        name: "login",
        component: () => import("@/views/login/login.vue"),
        meta: {
            title: "登录",
        },
    },
    {
        path: "/login/callback",
        name: "loginCallback",
        component: () => import("@/views/login/components/loginCallback/loginCallback.vue"),
        meta: {
            title: "三方登录",
        },
    },
    {
        path: "/patient",
        name: "patient",
        component: () => import("@/views/patient/patient.vue"),
        meta: {
            title: "家庭档案",
        },
    },
    {
        path: "/address",
        name: "address",
        component: () => import("@/views/address/address.vue"),
        meta: {
            title: "地址管理",
        },
    },
    {
        path: "/consultRecord",
        name: "consultRecord",
        component: () => import("@/views/consultRecord/consultRecord.vue"),
        meta: { title: "问诊订单列表" },
    },
    {
        path: "/consultDetail/:id",
        name: "consultDetail",
        component: () => import("@/views/consultDetail/consultDetail.vue"),
        meta: { title: "问诊订单详情" },
    },
    {
        path: "/consult",
        name: "consult",
        component: () => import("@/views/consult/consult.vue"),
        meta: { title: "极速问诊" },
    },
    {
        path: "/consult/department",
        name: "department",
        component: () => import("@/views/home/procedure/department/department.vue"),
        meta: { title: "科室列表" },
    },
    {
        path: "/consult/illness",
        name: "illness",
        component: () => import("@/views/home/procedure/illnessInfo/illnessInfo.vue"),
        meta: { title: "病情描述" },
    },
    {
        path: "/consult/pay",
        name: "pay",
        component: () => import("@/views/home/procedure/pay/pay.vue"),
        meta: { title: "问诊支付" },
    },
    {
        path: "/consult/chitchat",
        name: "chitchat",
        component: () => import("@/views/home/procedure/chitchat/chitchat.vue"),
        meta: { title: "问诊室" },
        beforeEnter(to: RouteLocationNormalized) {
            if (to.query.parResult === "false") {
                return "/consultRecord";
            }
        },
    },
    {
        path: "/medicine",
        name: "medicine",
        component: () => import("@/views/medicine/medicine.vue"),
        meta: { title: "开药门诊" },
    },
    {
        path: "/medicine/pay",
        name: "medicinePay",
        component: () => import("@/views/medicine/procedure/medicinePay/medicinePay.vue"),
        meta: { title: "药品支付" },
    },
    {
        path: "/medicinePay/result",
        name: "medicinePayResult",
        component: () => import("@/views/medicine/procedure/medicinePayResult/medicinePayResult.vue"),
        meta: { title: "药品支付结果" },
    },
    {
        path: "/medicinePay/detail",
        name: "medicinePayDetail",
        component: () => import("@/views/medicine/procedure/medicinePayDetail/medicinePayDetail.vue"),
        meta: { title: "药品订单详情" },
    },
    {
        path: "/doctor",
        name: "doctor",
        component: () => import("@/views/doctor/doctor.vue"),
        meta: { title: "问医生" },
    },
];
